package com.core.db.impl;

import java.net.UnknownHostException;

import com.core.db.MongoDBDAO;
import com.mongodb.DB;
import com.mongodb.DBCollection;
import com.mongodb.Mongo;
/**
 * 
 * TODO </br> 
 * 类名: MongoDBDAOImpl </br> 
 * 日期: 2014-2-28 上午11:21:14 </br> 
 * @author 许立亢 
 * @version 1.0
 */
public class MongoDBDAOImpl implements MongoDBDAO{
	private static Mongo mongo;
	private static DB db;
	private static DBCollection collection;
	
	static{
		try {
			mongo = new Mongo();
		} catch (UnknownHostException e) {
			System.out.println("连接mongo出错。。。。。。。");
			e.printStackTrace();
		}
		db = mongo.getDB("scm");
		System.out.println("  初始化！！！！！！");
	}
	/**
	 * 
	 * 获得一个表</br>
	 * 日期:2014-2-28 上午11:29:29
	 * @param name
	 * @return
	 */
	public DBCollection getCollection(String name){
		collection = db.getCollection(name);
		return collection;
	}
}
